package com.tangsm.spring.boot.swagger3.service.impl;

import com.tangsm.spring.boot.swagger3.domain.User;
import com.tangsm.spring.boot.swagger3.mapper.UserMapper;
import com.tangsm.spring.boot.swagger3.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户信息业务接口实现
 * @author tangsm
 * @date 2021-07-23
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getAll() {
        return userMapper.findAllUser();
    }

    @Override
    public User getByName(String name) {
        return userMapper.findUserByName(name);
    }

    @Override
    public int add(User user) {
        return userMapper.insertUser(user);
    }

    @Override
    public int update(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public int delete(int id) {
        return userMapper.deleteUser(id);
    }
}
